<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="keywords" content="imlgw,半岛铁盒,blog,Java博客,程序员,个人博客,java開發,程序員,個人博客,Java">
    <meta name="description" content="大悲无泪，大悟无言，大笑无声。">
    <meta name="author" content="Resolmi">
    
    <title>
        
            SpringMVC - 处理静态资源 (转) |
        
        Tadow
    </title>
    
<link rel="stylesheet" href="/css/style.css">

    <link rel="shortcut icon" href="https://static.imlgw.top/blog/20210731/BtJz541CcmJU.ico">
    <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/css/font-awesome.min.css">
    <script id="hexo-configurations">
    let KEEP = window.KEEP || {};
    KEEP.hexo_config = {"hostname":"imlgw.top","root":"/","language":"zh-CN","path":"search.json"};
    KEEP.theme_config = {"toc":{"enable":true,"number":true,"expand_all":true,"init_open":true},"style":{"primary_color":"#0066CC","avatar":"https://static.imlgw.top/blog/20210731/3C7hCSRR3lfq.png","favicon":"https://static.imlgw.top/blog/20210731/BtJz541CcmJU.ico","article_img_align":"left","left_side_width":"260px","content_max_width":"920px","hover":{"shadow":false,"scale":true},"first_screen":{"enable":true,"background_img":"/images/image.svg","description":"Keep It Simple & Stupid."},"scroll":{"progress_bar":{"enable":true},"percent":{"enable":true}}},"local_search":{"enable":true,"preload":false},"code_copy":{"enable":true,"style":"default"},"pjax":{"enable":true},"lazyload":{"enable":true},"version":"3.4.3"};
    KEEP.language_ago = {"second":"%s 秒前","minute":"%s 分钟前","hour":"%s 小时前","day":"%s 天前","week":"%s 周前","month":"%s 月前","year":"%s 年前"};
  </script>
<meta name="generator" content="Hexo 5.4.0"><link rel="stylesheet" href="/css/prism.css" type="text/css"></head>


<body>
<div class="progress-bar-container">
    
        <span class="scroll-progress-bar"></span>
    

    
        <span class="pjax-progress-bar"></span>
        <span class="pjax-progress-icon">
            <i class="fas fa-circle-notch fa-spin"></i>
        </span>
    
</div>


<main class="page-container">

    

    <div class="page-main-content">

        <div class="page-main-content-top">
            <header class="header-wrapper">

    <div class="header-content">
        <div class="left">
            
            <a class="logo-title" href="/">
                Tadow
            </a>
        </div>

        <div class="right">
            <div class="pc">
                <ul class="menu-list">
                    
                        <li class="menu-item">
                            <a class=""
                               href="/"
                            >
                                首页
                            </a>
                        </li>
                    
                        <li class="menu-item">
                            <a class=""
                               href="/archives"
                            >
                                归档
                            </a>
                        </li>
                    
                        <li class="menu-item">
                            <a class=""
                               href="/categories"
                            >
                                分类
                            </a>
                        </li>
                    
                        <li class="menu-item">
                            <a class=""
                               href="/sbe"
                            >
                                订阅
                            </a>
                        </li>
                    
                        <li class="menu-item">
                            <a class=""
                               href="/links"
                            >
                                友链
                            </a>
                        </li>
                    
                        <li class="menu-item">
                            <a class=""
                               href="/about"
                            >
                                关于
                            </a>
                        </li>
                    
                    
                        <li class="menu-item search search-popup-trigger">
                            <i class="fas fa-search"></i>
                        </li>
                    
                </ul>
            </div>
            <div class="mobile">
                
                    <div class="icon-item search search-popup-trigger"><i class="fas fa-search"></i></div>
                
                <div class="icon-item menu-bar">
                    <div class="menu-bar-middle"></div>
                </div>
            </div>
        </div>
    </div>

    <div class="header-drawer">
        <ul class="drawer-menu-list">
            
                <li class="drawer-menu-item flex-center">
                    <a class=""
                       href="/">首页</a>
                </li>
            
                <li class="drawer-menu-item flex-center">
                    <a class=""
                       href="/archives">归档</a>
                </li>
            
                <li class="drawer-menu-item flex-center">
                    <a class=""
                       href="/categories">分类</a>
                </li>
            
                <li class="drawer-menu-item flex-center">
                    <a class=""
                       href="/sbe">订阅</a>
                </li>
            
                <li class="drawer-menu-item flex-center">
                    <a class=""
                       href="/links">友链</a>
                </li>
            
                <li class="drawer-menu-item flex-center">
                    <a class=""
                       href="/about">关于</a>
                </li>
            
        </ul>
    </div>

    <div class="window-mask"></div>

</header>


        </div>

        <div class="page-main-content-middle">

            <div class="main-content">

                
                    <div class="fade-in-down-animation">
    <div class="article-content-container">

        <div class="article-title">
            <span class="title-hover-animation">SpringMVC - 处理静态资源 (转)</span>
        </div>

        
            <div class="article-header">
                <div class="avatar">
                    <img src="https://static.imlgw.top/blog/20210731/3C7hCSRR3lfq.png">
                </div>
                <div class="info">
                    <div class="author">
                        <span class="name">Resolmi</span>
                        
                            <span class="author-label">BOSS</span>
                        
                    </div>
                    <div class="meta-info">
                        <div class="article-meta-info">
    <span class="article-date article-meta-item">
        <i class="fas fa-edit"></i>&nbsp;2018-05-21 00:00:00
    </span>
    
        <span class="article-categories article-meta-item">
            <i class="fas fa-folder"></i>&nbsp;
            <ul>
                
                    <li>
                        <a href="/categories/Web/">Web</a>&nbsp;
                    </li>
                
            </ul>
        </span>
    
    
        <span class="article-tags article-meta-item">
            <i class="fas fa-tags"></i>&nbsp;
            <ul>
                
                    <li>
                        <a href="/tags/%E6%8A%80%E6%9C%AF/">技术</a>&nbsp;
                    </li>
                
                    <li>
                        | <a href="/tags/Spring/">Spring</a>&nbsp;
                    </li>
                
                    <li>
                        | <a href="/tags/%E8%BD%AC%E8%BD%BD/">转载</a>&nbsp;
                    </li>
                
            </ul>
        </span>
    

    
    
        <span class="article-wordcount article-meta-item">
            <i class="fas fa-file-word"></i>&nbsp;<span>1.6k 字</span>
        </span>
    
    
        <span class="article-min2read article-meta-item">
            <i class="fas fa-clock"></i>&nbsp;<span>7 分钟</span>
        </span>
    
    
        <span class="article-pv article-meta-item">
            <i class="fas fa-eye"></i>&nbsp;<span id="busuanzi_value_page_pv"></span>
        </span>
    
</div>

                    </div>
                </div>
            </div>
        

        <div class="article-content markdown-body">
            <h2 id="【1】第一种示例与解决办法"><a href="#【1】第一种示例与解决办法" class="headerlink" title="【1】第一种示例与解决办法"></a><strong>【1】第一种示例与解决办法</strong></h2><p>将DispatcherServlet请求映射设置为 / ，将会拦截所有的请求。不能访问静态资源。</p>
<p><strong>解决办法：</strong></p>
<p>在SpringMVC的配置文件中配置如下标签解决</p>
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line">&lt;mvc:<span class="keyword">default</span>-servlet-handler/&gt;</span><br></pre></td></tr></table></figure>

<p>其XSD文档说明如下:</p>
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">/*配置一个handler通过转发请求到servlet容器的默认servlet来处理静态资源*/</span></span><br><span class="line">Configures a handler <span class="keyword">for</span> serving <span class="keyword">static</span> resources by forwarding to the Servlet container<span class="string">&#x27;s default Servlet.</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">/*使用该handler将会允许DispatcherServlet 的url-pattern为&#x27;</span>/<span class="string">&#x27;;同时使用servlet容器的默认servlet处理静态资源*/</span></span><br><span class="line"><span class="string">Use of this handler allows using a &quot;/&quot; mapping with the DispatcherServlet </span></span><br><span class="line"><span class="string">while still utilizing the Servlet container to serve static resources. </span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">/*该handler将会转发所有请求到默认servlet*/</span></span><br><span class="line"><span class="string">This handler will forward all requests to the default Servlet. </span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">/*因此将该handler的执行顺序放到所有请求处理的最后是非常重要的！！！*/</span></span><br><span class="line"><span class="string">Therefore it is important that it remains last in the order of all other URL HandlerMappings. </span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">/*使用&lt;mvc:annotation-driven/&gt;标签或者设置HandlerMapping instance的order来确保DefaultServletHttpRequestHandler的order最大。*/</span></span><br><span class="line"><span class="string">That will be the case if you use the &quot;annotation-driven&quot; element </span></span><br><span class="line"><span class="string">or alternatively if you are setting up your customized HandlerMapping instance </span></span><br><span class="line"><span class="string">be sure to set its &quot;order&quot; property to a value lower than </span></span><br><span class="line"><span class="string">that of the DefaultServletHttpRequestHandler, which is Integer.MAX_VALUE.</span></span><br></pre></td></tr></table></figure>

<p><img  
                     lazyload
                     src="/images/loading.svg"
                     data-src="https://img-blog.csdn.net/20170914152551033?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvSjA4MDYyNA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast"
                      alt="image"
                ></p>
<p><strong>解释如下：</strong></p>
<p><code>&lt;mvc:default-servlet-handler/&gt;</code>将在SpringMVC的上下文中定义一个DefaultServletHttpRequestHandler来处理静态资源(其实就是将请求转发给默认的servlet)。</p>
<p>一般WEB服务器默认的servlet的名称为default。若所使用的WEB服务器默认的Servlet名称不是default，则需要通过default-servlet-name 属性指定！</p>
<p><img  
                     lazyload
                     src="/images/loading.svg"
                     data-src="https://img-blog.csdn.net/20170224143539025?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvSjA4MDYyNA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast"
                      alt="image"
                ></p>
<hr>
<p><strong>不同服务器下默认servlet名字对应如下：</strong></p>
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line">Tomcat, Jetty, JBoss, and GlassFish  默认 Servlet的名字 -- <span class="string">&quot;default&quot;</span></span><br><span class="line">Google App Engine 默认 Servlet的名字 -- <span class="string">&quot;_ah_default&quot;</span></span><br><span class="line">Resin 默认 Servlet的名字 -- <span class="string">&quot;resin-file&quot;</span></span><br><span class="line">WebLogic 默认 Servlet的名字  -- <span class="string">&quot;FileServlet&quot;</span></span><br><span class="line">WebSphere  默认 Servlet的名字 -- <span class="string">&quot;SimpleFileServlet&quot;</span></span><br></pre></td></tr></table></figure>

<p><img  
                     lazyload
                     src="/images/loading.svg"
                     data-src="https://img-blog.csdn.net/20170914154653746?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvSjA4MDYyNA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast"
                      alt="这里写图片描述"
                ></p>
<hr>
<p><strong>【Tips：】</strong></p>
<p>使用上述配置，你会发现正常的Controller跳转失效了！</p>
<p>XSD说明最后一段话如下：</p>
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">/*使用&lt;mvc:annotation-driven/&gt;标签或者设置HandlerMapping instance的order来确保DefaultServletHttpRequestHandler的order最大。*/</span></span><br><span class="line">That will be the <span class="keyword">case</span> <span class="keyword">if</span> you use the <span class="string">&quot;annotation-driven&quot;</span> element </span><br><span class="line">or alternatively <span class="keyword">if</span> you are setting up your customized HandlerMapping instance </span><br><span class="line">be sure to set its <span class="string">&quot;order&quot;</span> property to a value lower than </span><br><span class="line">that of the DefaultServletHttpRequestHandler, which is Integer.MAX_VALUE.</span><br></pre></td></tr></table></figure>

<p>也就是说，要么配置<code>&lt;mvc:annotation-driven /&gt;</code>标签，要么手动注册请求映射处理bean于xml中，并设置order属性值，以其实现框架中处理请求映射的bean的order值小于DefaultServletHttpRequestHandler的order属性值！！！</p>
<p>常用的解决方式为配置<code>&lt;mvc:annotation-driven /&gt;</code>标签，详情点击查看<a class="link"   target="_blank" rel="noopener" href="http://blog.csdn.net/j080624/article/details/66969987" >请求映射失效<i class="fas fa-external-link-alt"></i></a>。</p>
<p>点击查看<a class="link"   target="_blank" rel="noopener" href="http://blog.csdn.net/J080624/article/details/66969987" >controller映射失效<i class="fas fa-external-link-alt"></i></a></p>
<hr>
<h2 id="【2】第二种示例与解决办法"><a href="#【2】第二种示例与解决办法" class="headerlink" title="【2】第二种示例与解决办法"></a><strong>【2】第二种示例与解决办法</strong></h2><p>解决静态资源的思路是，在SpringMVC.xml中，拦截设置为”*.do”，而不是”/”。</p>
<p>这样就不会拦截静态资源的请求。</p>
<p>需要注意的是，如果项目中用到了shiro或者其他权限框架。那么需要注意你的shiro.xml配置，示例如下：</p>
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line">&lt;bean id=<span class="string">&quot;shiroFilter&quot;</span> <span class="class"><span class="keyword">class</span></span>=<span class="string">&quot;org.apache.shiro.spring.web.ShiroFilterFactoryBean&quot;</span>&gt;</span><br><span class="line">      &lt;!-- Shiro的核心安全接口,这个属性是必须的 --&gt;</span><br><span class="line">      &lt;property name=<span class="string">&quot;securityManager&quot;</span> ref=<span class="string">&quot;securityManager&quot;</span>/&gt;</span><br><span class="line">      &lt;!-- loginUrl认证提交地址，如果没有认证将会请求此地址进行认证，请求此地址将由formAuthenticationFilter进行表单认证 --&gt;</span><br><span class="line">      &lt;property name=<span class="string">&quot;loginUrl&quot;</span> value=<span class="string">&quot;/login&quot;</span>/&gt;</span><br><span class="line"></span><br><span class="line">      &lt;!-- Shiro连接约束配置,即过滤链的定义 --&gt;</span><br><span class="line">      &lt;property name=<span class="string">&quot;filterChainDefinitions&quot;</span>&gt;</span><br><span class="line">          &lt;value&gt;</span><br><span class="line">              &lt;!-- <span class="comment">/** = anon所有url都可以匿名访问 --&gt;</span></span><br><span class="line"><span class="comment">              &lt;!-- 对静态资源设置匿名访问 --&gt;</span></span><br><span class="line"><span class="comment">              /images/** = anon</span></span><br><span class="line"><span class="comment">              /js/** = anon</span></span><br><span class="line"><span class="comment">              /styles/** = anon</span></span><br><span class="line"><span class="comment">              &lt;!-- 验证码，可匿名访问 --&gt;</span></span><br><span class="line"><span class="comment">              /validateCode = anon  &lt;!--验证码--&gt;</span></span><br><span class="line"><span class="comment">              /doLogin = anon</span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment">              &lt;!-- /** = authc 所有url都必须认证通过才可以访问 --&gt;</span></span><br><span class="line"><span class="comment">              /**=authc</span></span><br><span class="line"><span class="comment">              &lt;!--请求logout，shrio擦除sssion--&gt;</span></span><br><span class="line"><span class="comment">              /logout=logout</span></span><br><span class="line"><span class="comment">          &lt;/value&gt;</span></span><br><span class="line"><span class="comment">      &lt;/property&gt;</span></span><br><span class="line"><span class="comment">  &lt;/bean&gt;</span></span><br></pre></td></tr></table></figure>

<p>需要注意的是虽然SpringMVC拦截的是.do，但是由于使用了shiro(或者你的其他权限框架)，那么未登录情况下是不能直接访问除shiro配置文件里面允许匿名访问的路径之外的静态资源文件。</p>
<p>举个例子，你把静态资源文件放在了项目根目录，但是参考上面配置文件，显然不在匿名访问路径列表之内，所以会提示你先登录，登录之后才可访问项目根目录的静态资源文件。</p>
<ul>
<li>  未登录前访问项目根目录下1.jpg , 跳到登录页面：</li>
</ul>
<p><img  
                     lazyload
                     src="/images/loading.svg"
                     data-src="https://img-blog.csdn.net/20170518094647021?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvSjA4MDYyNA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast"
                      alt="image"
                ></p>
<ul>
<li>  登录后访问项目根目录下1.jpg :</li>
</ul>
<p><img  
                     lazyload
                     src="/images/loading.svg"
                     data-src="https://img-blog.csdn.net/20170518094717006?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvSjA4MDYyNA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast"
                      alt="image"
                ></p>
<p>另外，建议最好参考shiro配置文件，比如1.jpg放到images文件夹下，那么不用登录就可以直接访问。</p>
<p><img  
                     lazyload
                     src="/images/loading.svg"
                     data-src="https://img-blog.csdn.net/20170518094833869?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvSjA4MDYyNA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast"
                      alt="image"
                ></p>
<hr>
<h2 id="【3】第三种示例与解决办法"><a href="#【3】第三种示例与解决办法" class="headerlink" title="【3】第三种示例与解决办法"></a><strong>【3】第三种示例与解决办法</strong></h2><p><strong>通过配置，避免静态资源被拦截，示例如下：</strong></p>
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line">&lt;!-- 静态资源访问（不拦截此目录下的东西的访问） --&gt;</span><br><span class="line">   &lt;mvc:resources location=<span class="string">&quot;/js/&quot;</span> mapping=<span class="string">&quot;/js/**&quot;</span>/&gt;</span><br><span class="line">   &lt;mvc:resources location=<span class="string">&quot;/css/&quot;</span> mapping=<span class="string">&quot;/css/**&quot;</span>/&gt;</span><br><span class="line">   &lt;mvc:resources location=<span class="string">&quot;/images/&quot;</span> mapping=<span class="string">&quot;/images/**&quot;</span>/&gt;</span><br><span class="line">   &lt;mvc:resources location=<span class="string">&quot;/bootstrap/&quot;</span> mapping=<span class="string">&quot;/bootstrap/**&quot;</span>/&gt;</span><br></pre></td></tr></table></figure>

<p>该标签的xsd说明文档如下：</p>
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">/*配置handler为静态资源，如images，js和CSS文件并进行缓存头优化，以便在Web浏览器中高效加载。*/</span><br><span class="line">Configures a handler for serving static resources such as </span><br><span class="line">images, js, and, css files with cache headers optimized for efficient loading in a web browser. </span><br><span class="line">/*允许为任何可以通过spring处理的路径资源提供服务*/</span><br><span class="line">Allows resources to be served out of any path that is reachable via Spring&#x27;s Resource handling.</span><br></pre></td></tr></table></figure>

<p>注册的handler如下：</p>
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line">org.springframework.web.servlet.resource.ResourceHttpRequestHandler</span><br></pre></td></tr></table></figure>

<p><strong>即，该标签注册ResourceHttpRequestHandler为静态资源的访问提供服务。</strong></p>
<p>该handler的javadoc如下所示：</p>
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line">&#123;<span class="meta">@code</span> HttpRequestHandler&#125; that serves <span class="keyword">static</span> resources in an optimized way according to the guidelines of Page Speed, YSlow, etc.</span><br><span class="line"></span><br><span class="line"> * &lt;p&gt;The &#123;<span class="meta">@linkplain</span> #setLocations <span class="string">&quot;locations&quot;</span>&#125; property takes a list of Spring</span><br><span class="line"> * &#123;<span class="meta">@link</span> Resource&#125; locations from which <span class="keyword">static</span> resources are allowed to</span><br><span class="line"> * be served by <span class="keyword">this</span> handler. Resources could be served from a classpath location,</span><br><span class="line"> * e.g. <span class="string">&quot;classpath:/META-INF/public-web-resources/&quot;</span>, allowing convenient packaging</span><br><span class="line"> * and serving of resources such as .js, .css, and others in jar files.</span><br></pre></td></tr></table></figure>

<hr>
<h2 id="【4】第四种示例与解决办法"><a href="#【4】第四种示例与解决办法" class="headerlink" title="【4】第四种示例与解决办法"></a><strong>【4】第四种示例与解决办法</strong></h2><p>确切说这里只解决不通过controller而直接访问jsp的问题。</p>
<p><code>&lt;mvc:view-controller/&gt;</code>直接访问view-name对应的jsp</p>
<ul>
<li>  jsp路径依据视图解析器配置。</li>
</ul>
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line">&lt;!-- mvc:view-controller可使其直接访问路径 --&gt;  </span><br><span class="line">&lt;mvc:view-controller path=<span class="string">&quot;/i18n&quot;</span> view-name=<span class="string">&quot;i18n&quot;</span>/&gt;</span><br><span class="line"></span><br><span class="line">&lt;mvc:view-controller path=<span class="string">&quot;/i18n2&quot;</span> view-name=<span class="string">&quot;i18n2&quot;</span>/&gt;</span><br></pre></td></tr></table></figure>

        </div>

        
            <div class="post-copyright-info">
                <div class="article-copyright-info-container">
    <ul>
        <li>本文标题：SpringMVC - 处理静态资源 (转)</li>
        <li>本文作者：Resolmi</li>
        <li>创建时间：2018-05-21 00:00:00</li>
        <li>
            本文链接：https://imlgw.top/2018/05/21/eb5cc3c6/
        </li>
        <li>
            版权声明：本博客所有文章除特别声明外，均采用 <a class="license" target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">BY-NC-SA</a> 许可协议。转载请注明出处！
        </li>
    </ul>
</div>

            </div>
        

        
            <div class="article-nav">
                
                    <div class="article-prev">
                        <a class="prev"
                           rel="prev"
                           href="/2018/05/23/d2be9bab/"
                        >
                            <span class="left arrow-icon flex-center">
                              <i class="fas fa-chevron-left"></i>
                            </span>
                            <span class="title flex-center">
                                <span class="post-nav-title-item">Mybatis逆向工程对text的特殊处理</span>
                                <span class="post-nav-item">上一篇</span>
                            </span>
                        </a>
                    </div>
                
                
                    <div class="article-next">
                        <a class="next"
                           rel="next"
                           href="/2018/05/17/81b3fc53/"
                        >
                            <span class="title flex-center">
                                <span class="post-nav-title-item">Spring请求参数获取的几种方式（转）</span>
                                <span class="post-nav-item">下一篇</span>
                            </span>
                            <span class="right arrow-icon flex-center">
                              <i class="fas fa-chevron-right"></i>
                            </span>
                        </a>
                    </div>
                
            </div>
        

        
            <div class="comment-container">
                <div class="comments-container">
    <div id="comment-anchor"></div>
    <div class="comment-area-title">
        <i class="fas fa-comments">&nbsp;评论</i>
    </div>
    

        
            <section class="disqus-comments">
<div id="disqus_thread">
  <noscript>Please enable JavaScript to view the <a target="_blank" rel="noopener" href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
</section>

<script>
var disqus_shortname = 'imlgw';

var disqus_url = 'https://imlgw.top/2018/05/21/eb5cc3c6/';

(function(){
  var dsq = document.createElement('script');
  dsq.type = 'text/javascript';
  dsq.async = true;
  dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>

<script id="dsq-count-scr" src="//imlgw.disqus.com/count.js" async></script>
        
    
</div>

            </div>
        
    </div>
</div>


                
            </div>

        </div>

        <div class="page-main-content-bottom">
            <footer class="footer">
    <div class="info-container">
        <div class="copyright-info info-item">
            &copy;
            
              <span>2018</span>&nbsp;-&nbsp;
            
            2021&nbsp;<i class="fas fa-heart icon-animate"></i>&nbsp;<a href="/">Resolmi</a>
        </div>
        
            <script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
            <div class="website-count info-item">
                
                    <span id="busuanzi_container_site_uv">
                        访问人数&nbsp;<span id="busuanzi_value_site_uv"></span>&ensp;
                    </span>
                
                
                    <span id="busuanzi_container_site_pv">
                        总访问量&nbsp;<span id="busuanzi_value_site_pv"></span>
                    </span>
                
            </div>
        
        
            <div class="icp-info info-item"><a target="_blank" rel="nofollow" href="https://beian.miit.gov.cn">鄂ICP备18011208号</a></div>
        
    </div>
</footer>

        </div>
    </div>

    
        <div class="post-tools">
            <div class="post-tools-container">
    <ul class="tools-list">
        <!-- TOC aside toggle -->
        
            <li class="tools-item page-aside-toggle">
                <i class="fas fa-outdent"></i>
            </li>
        

        <!-- go comment -->
        
            <li class="go-comment">
                <i class="fas fa-comment"></i>
            </li>
        
    </ul>
</div>

        </div>
    

    <div class="right-bottom-side-tools">
        <div class="side-tools-container">
    <ul class="side-tools-list">
        <li class="tools-item tool-font-adjust-plus flex-center">
            <i class="fas fa-search-plus"></i>
        </li>

        <li class="tools-item tool-font-adjust-minus flex-center">
            <i class="fas fa-search-minus"></i>
        </li>

        <li class="tools-item tool-expand-width flex-center">
            <i class="fas fa-arrows-alt-h"></i>
        </li>

        <li class="tools-item tool-dark-light-toggle flex-center">
            <i class="fas fa-moon"></i>
        </li>

        <!-- rss -->
        

        

        <li class="tools-item tool-scroll-to-bottom flex-center">
            <i class="fas fa-arrow-down"></i>
        </li>
    </ul>

    <ul class="exposed-tools-list">
        <li class="tools-item tool-toggle-show flex-center">
            <i class="fas fa-cog fa-spin"></i>
        </li>
        
            <li class="tools-item tool-scroll-to-top flex-center">
                <i class="arrow-up fas fa-arrow-up"></i>
                <span class="percent"></span>
            </li>
        
    </ul>
</div>

    </div>

    
        <aside class="page-aside">
            <div class="post-toc-wrap">
    <div class="post-toc">
        <ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E3%80%901%E3%80%91%E7%AC%AC%E4%B8%80%E7%A7%8D%E7%A4%BA%E4%BE%8B%E4%B8%8E%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95"><span class="nav-number">1.</span> <span class="nav-text">【1】第一种示例与解决办法</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E3%80%902%E3%80%91%E7%AC%AC%E4%BA%8C%E7%A7%8D%E7%A4%BA%E4%BE%8B%E4%B8%8E%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95"><span class="nav-number">2.</span> <span class="nav-text">【2】第二种示例与解决办法</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E3%80%903%E3%80%91%E7%AC%AC%E4%B8%89%E7%A7%8D%E7%A4%BA%E4%BE%8B%E4%B8%8E%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95"><span class="nav-number">3.</span> <span class="nav-text">【3】第三种示例与解决办法</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E3%80%904%E3%80%91%E7%AC%AC%E5%9B%9B%E7%A7%8D%E7%A4%BA%E4%BE%8B%E4%B8%8E%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95"><span class="nav-number">4.</span> <span class="nav-text">【4】第四种示例与解决办法</span></a></li></ol>
    </div>
</div>
        </aside>
    

    <div class="image-viewer-container">
    <img src="">
</div>


    
        <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
          <span class="search-input-field-pre">
            <i class="fas fa-keyboard"></i>
          </span>
            <div class="search-input-container">
                <input autocomplete="off"
                       autocorrect="off"
                       autocapitalize="off"
                       placeholder="搜索..."
                       spellcheck="false"
                       type="search"
                       class="search-input"
                >
            </div>
            <span class="popup-btn-close">
                <i class="fas fa-times"></i>
            </span>
        </div>
        <div id="search-result">
            <div id="no-result">
                <i class="fas fa-spinner fa-pulse fa-5x fa-fw"></i>
            </div>
        </div>
    </div>
</div>

    

</main>



<script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/utils.js"></script><script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/main.js"></script><script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/header-shrink.js"></script><script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/back2top.js"></script><script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/dark-light-toggle.js"></script>


    <script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/local-search.js"></script>



    <script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/code-copy.js"></script>



    <script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/lazyload.js"></script>


<div class="post-scripts pjax">
    
        <script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/left-side-toggle.js"></script><script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/libs/anime.min.js"></script><script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/toc.js"></script>
    
</div>


    <script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/libs/pjax.min.js"></script>
<script>
    window.addEventListener('DOMContentLoaded', () => {
        window.pjax = new Pjax({
            selectors: [
                'head title',
                '.page-container',
                '.pjax'
            ],
            history: true,
            debug: false,
            cacheBust: false,
            timeout: 0,
            analytics: false,
            currentUrlFullReload: false,
            scrollRestoration: false,
            // scrollTo: true,
        });

        document.addEventListener('pjax:send', () => {
            KEEP.utils.pjaxProgressBarStart();
        });

        document.addEventListener('pjax:complete', () => {
            KEEP.utils.pjaxProgressBarEnd();
            window.pjax.executeScripts(document.querySelectorAll('script[data-pjax], .pjax script'));
            KEEP.refresh();
        });
    });
</script>



<script src="https://cdn.jsdelivr.net/npm/live2d-widget@3.x/lib/L2Dwidget.min.js"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"debug":false,"model":{"jsonPath":"https://cdn.jsdelivr.net/npm/live2d-widget-model-hijiki@1.0.5/assets/hijiki.model.json"},"display":{"superSample":2,"width":160,"height":320,"position":"right","hOffset":0,"vOffset":-70},"mobile":{"show":false,"scale":0.2},"log":false});</script></body>
</html>
